// 斐波那契数列：[1, 1, 2, 3, 5, ...]   fn(n) = fn(n-1) + fn(n-2)

// 输入长度为n的斐波那契数列
function fibonacci(n) {
  if (n === 1) return [1];
  if (n === 2) return [1, 1];

  let res = [1, 1];
  for (let i = 2; i < n; i++) {
    res[i] = res[i - 1] + res[i - 2];
  }

  return res;
}
console.log("长度为10的斐波那契数列", fibonacci(10));
